#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

class people{
public:
	int score;
	int id;
};
bool operator<(people a,people b){
	if(a.score<b.score)return true;
	if(a.score==b.score&&a.id>b.id)return true;
	return false;
}

int main(void){
	int n,m;
	vector<people> data;
	people temp;
	int x,y;
	cin>>n>>m;
	y=m*1.5;
	for(int i=0;i<n;i++){
		cin>>temp.id>>temp.score;
		data.push_back(temp);
	}
	sort(data.rbegin(),data.rend());
	x=data[y-1].score;
	for(;data[y-1].score==data[y].score;y++);
	cout<<x<<' '<<y<<endl;
	for(int i=0;data[i].score>=x;i++){
		cout<<data[i].id<<' '<<data[i].score<<endl;
	}
	return 0;
}